package com.tuyrt.firstcode.utils

import retrofit2.Retrofit
import retrofit2.converter.gson.GsonConverterFactory

/**
 * Created by tuyrt7 on 2021/4/12.
 */
object ServiceCreator {

    private const val BASE_URL = "https://www.baidu.com/"

    private val retrofit = Retrofit.Builder()
        .baseUrl(BASE_URL)
        .addConverterFactory(GsonConverterFactory.create())
        .build()

    fun <T> create(clazz: Class<T>): T = retrofit.create(clazz)

    inline fun <reified T> create() = create(T::class.java)
}